function B = fct(num1,new_pre_y01,new_pre_y02)
x4 = num1
L11 = new_pre_y01
L12 = new_pre_y02
if x4 == 0
    if L11 < 2000 &L12 < 2000 
        ran0_1 = rand(1)
        if ran0_1 < 0.95 
            B = 0
        else 
            ran0_2 = rand(1)
            if ran0_2 < 0.0167 
                B= 0.5
            else 
                ran0_3 = rand(1)
                if ran0_3 < 0.0167 
                    B = 0.75
                else 
                    ran0_4 = rand(1)
                    if ran0_4 < 0.0083 
                        B = 0.25
                    else 
                        rann = rand(1)
                        if rann < 0.0083 
                            B = 1
                        else 
                            B = 0
                        end
                    end
                end
            end
        end
    elseif L11 < 2000 & L12 >= 2000 
        ran0_5 = rand(1)
        if ran0_5 < 0.4881 
            B = 1
        else 
            ran0_6 = rand(1)
            if ran0_6 < 0.3452 
                B = 0
            else 
                ran0_7 = rand(1)
                if ran0_7 < 0.1071 
                    B = 0.75
                else 
                    rann = rand(1)
                    if rann < 0.0357 
                        B = 0.5
                    else 
                        B = 1
                    end
                end
            end
        end
    elseif L11 >= 2000 & L12 >= 2000 
        ran0_8 = rand(1)
        if ran0_8 < 0.4688 
            B = 0
        else 
            ran0_9 = rand(1)
            if ran0_9 < 0.3438 
                B = 1
            else 
                ran0_10 = rand(1)
                if ran0_10 < 0.125 
                    B = 0.75
                else 
                    rann = rand(1)
                    if rann < 0.0625 
                        B = 0.5
                    else 
                        B = 0
                    end
                end
            end
        end
    elseif L11 >= 2000 & L12 < 2000 
        B = 0
    end
else 
    if x4 == 0.25 
        if L11 < 2000 & L12 < 2000 
            ran1_1 = rand(1)
            if ran1_1 < 0.9427 
                B = 0.25
            else 
                ran1_2 = rand(1)
                if ran1_2 < 0.0191 
                    B = 0
                else 
                    ran1_3 = rand(1)
                    if ran1_3 < 0.0191 
                        B = 0.75
                    else 
                        ran1_4 = rand(1)
                        if ran1_4 < 0.0127 
                            B = 0.5
                        else 
                            rann = rand(1)
                            if rann < 0.0064 
                                B = 1
                            else 
                                B = 0.25
                            end
                        end
                    end
                end
            end
        elseif L11 < 2000 & L12 >= 2000 
            ran1_5 = rand(1)
            if ran1_5 < 0.5827 
                B = 0.25
            else 
                ran1_6 = rand(1)
                if ran1_6 < 0.3071 
                    B = 1
                else 
                    ran1_7 = rand(1)
                    if ran1_7 < 0.0945 
                        B = 0.75
                    else 
                        rann = rand(1)
                        if rann < 0.0157 
                            B = 0.5
                        else 
                            B = 0.25
                        end
                    end
                end
            end
        elseif L11 >= 2000 & L12 >= 2000 
            ran1_8 = rand(1)
            if ran1_8 < 0.4823 
                B = 0.25
            else 
                ran1_9 = rand(1)
                if ran1_9 < 0.3688 
                    B = 1
                else 
                    ran1_10 = rand(1)
                    if ran1_10 < 0.1064 
                        B = 0.75
                    else 
                        rann = rand(1)
                        if rann < 0.0426 
                            B = 0.5
                        else 
                            B = 0.25
                        end
                    end
                end
            end
        elseif L11 >= 2000 & L12 < 2000 
            B = 0.25
        end
    else  
        if x4 == 0.5 
            if L11 < 2000 & L12 < 2000 
                ran2_1 = rand(1)
                if ran2_1 < 0.98 
                    B = 0.5
                else 
                    ran2_2 = rand(1)
                    if ran2_2 < 0.02 
                        B = 0
                    else 
                        ran2_3 = rand(1)
                        if ran2_3 < 0.0133 
                            B = 0.75
                        else 
                            ran2_4 = rand(1)
                            if ran2_4 < 0.0067 
                                B = 0.25
                            else 
                                rann = rand(1)
                                if rann < 0.0067 
                                    B = 1
                                else 
                                    B = 0.5
                                end
                            end
                        end
                    end
                end
            elseif L11 < 2000 & L12 >= 2000 
                ran2_5 = rand(1)
                if ran2_5 < 0.6473 
                    B = 0.5
                else 
                    ran2_6 = rand(1)
                    if ran2_6 < 0.314 
                        B = 1
                    else 
                        rann = rand(1)
                        if rann < 0.0388 
                            B = 0.75
                        else 
                            B = 0.5
                        end
                    end
                end
            elseif L11 >= 2000 & L12 >= 2000 
                ran2_7 = rand(1)
                if ran2_7 < 0.7258 
                    B = 0.5
                else 
                    ran2_8 = rand(1)
                    if ran2_8 < 0.2258 
                        B = 1
                    else 
                        rann = rand(1)
                        if rann < 0.0484 
                            B = 0.75
                        else 
                            B = 0.5
                        end
                    end
                end
            elseif L11 >= 2000 & L12 < 2000 
                ran2_9 = rand(1)
                if ran2_9 < 0.825 
                    B = 0.5
                else 
                    ran2_10 = rand(1)
                    if ran2_10 < 0.1 
                        B = 0.25
                    else 
                        rann = rand(1)
                        if rann < 0.075 
                            B = 0
                        else 
                            B = 0.5
                        end
                    end
                end
            end
        else  
            if x4 == 0.75 
                if L11 < 2000 & L12 < 2000 
                    ran3_1 = rand(1)
                    if ran3_1 < 0.8786 
                        B = 0.75
                    else 
                        ran3_2 = rand(1)
                        if ran3_2 < 0.0462 
                            B = 0.5
                        else 
                            ran3_3 = rand(1)
                            if ran3_3 < 0.0347 
                                B = 0.25
                            else 
                                ran3_4 = rand(1)
                                if ran3_4 < 0.0231 
                                    B = 0
                                else 
                                    rann = rand(1)
                                    if rann < 0.0173 
                                        B = 1
                                    else 
                                        B = 0.75
                                    end
                                end
                            end
                        end
                    end
                elseif L11 < 2000 & L12 >= 2000 
                    ran3_5 = rand(1)
                    if ran3_5 < 0.646 
                        B = 0.75
                    else 
                        ran3_6 = rand(1)
                        if ran3_6 < 0.3292 
                            B = 1
                        else 
                            rann = rand(1)
                            if rann < 0.0186 
                                B = 0.5
                            else 
                                B = 0.75
                            end
                        end
                    end
                elseif L11 >= 2000 & L12 >= 2000 
                    ran3_7 = rand(1)
                    if ran3_7 < 0.7325 
                        B = 0.75
                    else 
                        ran3_8 = rand(1)
                        if ran3_8 < 0.2634 
                            B = 1
                        else 
                            rann = rand(1)
                            if rann < 0.0041 
                                B = 0.5
                            else 
                                B = 0.75
                            end
                        end
                    end
                elseif L11 >= 2000 & L12 < 2000 
                    ran3_9 = rand(1)
                    if ran3_9 < 0.7179 
                        B= 0.75
                    else 
                        ran3_10 = rand(1)
                        if ran3_10 < 0.1026 
                            B = 0.25
                        else 
                            ran3_11 = rand(1)
                            if ran3_11 < 0.1026 
                                B = 0.5
                            else 
                                ran3_12 = rand(1)
                                if ran3_12 < 0.0513 
                                    B = 0
                                else 
                                    rann = rand(1)
                                    if rann < 0.0256 
                                        B = 1
                                    else 
                                        B = 0.75
                                    end
                                end
                            end
                        end
                    end
                end
            else 
                if x4 == 1 
                    if L11 < 2000 & L12 < 2000 
                        ran4_1 = rand(1)
                        if ran4_1 < 0.7219 
                            B = 1
                        else 
                            ran4_2 = rand(1)
                            if ran4_2 < 0.1006 
                                B = 0.25
                            else 
                                ran4_3 = rand(1)
                                if ran4_3 < 0.1006 
                                    B = 0.5
                                else 
                                    ran4_4 = rand(1)
                                    if ran4_4 < 0.0296 
                                        B = 0.75
                                    else 
                                        rann = rand(1)
                                        if rann < 0.0237 
                                            B = 0
                                        else 
                                            B = 1
                                        end
                                    end
                                end
                            end
                        end
                    elseif L11 < 2000 & L12 >= 2000 
                        ran4_5 = rand(1)
                        if ran4_5 < 0.9565 
                            B = 1
                        else 
                            rann = rand(1)
                            if rann < 0.0435 
                                B = 0.75
                            else 
                                B = 1
                            end
                        end
                    elseif L11 >= 2000 & L12 >= 2000 
                        ran4_6 = rand(1)
                        if ran4_6 < 0.9875 
                            B = 1
                        else 
                            rann = rand(1)
                            if rann < 0.0125 
                                B = 0.75
                            else 
                                B = 1
                            end
                        end
                    elseif L11 >= 2000 & L12 < 2000 
                        ran4_7 = rand(1)
                        if ran4_7 < 0.8526 
                            B = 1
                        else 
                            ran4_8 = rand(1)
                            if ran4_8 < 0.0641 
                                B = 0.75
                            else 
                                ran4_9 = rand(1)
                                if ran4_9 < 0.0577 
                                    B = 0.5
                                else 
                                    ran4_10 = rand(1)
                                    if ran4_10 < 0.0513 
                                        B = 0.25
                                    else 
                                        rann = rand(1)
                                        if rann < 0.0128 
                                            B = 0
                                        else 
                                            B = 1
                                        end
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
    end
end
